package com.sinosoft.tcmemr.manager.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sinosoft.tcmemr.dao.PatientEntityMapper;
import com.sinosoft.tcmemr.entity.PatientEntity;
import com.sinosoft.tcmemr.manager.PatientManager;


@Component
public class PatientManagerImpl implements PatientManager {
	@Autowired
	private PatientEntityMapper patientmapper;
	
	/**
     * 增加病人信息
     * @param patient
     * @return
     */
    public boolean insertSelective(PatientEntity patient){
    	if( patient == null ){
    		return false;
    	}
    	patientmapper.insertSelective(patient);
    	return true;
    }
	
    /**
     * 查询病人信息
     * @param id
     * @return
     */
    public PatientEntity selectByPrimaryKey(Integer id){
    	return patientmapper.selectByPrimaryKey(id);
    }

    /**
     * 根据条件病人病历ID查询
     * @param ehrId
     * @return
     */
    public List<PatientEntity> selectBySearchEHRID(String ehrId){
    	return patientmapper.selectBySearchEHRID(ehrId);
    }
    
    /**
     * 根据身份证查询
     * @param identifyCardid
     * @return
     */
    public List<PatientEntity> selectBySearchByIdentifyCard(String identifyCardid){
    	return patientmapper.selectBySearchByIdentifyCard(identifyCardid);
    }
    /**
     * 根据条件查询
     * @param name
     * @param gender
     * @param birthday
     * @return
     */
    public List<PatientEntity> selectBySearchCon(String name,String gender,Date birthday){
    	return patientmapper.selectBySearchCon(name, gender, birthday);
    }
    
}
